var Buffer = require('buffer');
var mysql = require('mysql');
var userPool = false;

if (userPool) {
	var pool = mysql.createPool({
		connectionLimit : 5,
		host : 'localhost',
		user : 'root',
		password : 'root',
		database : 'tenmalife-platform'
	});
	pool.getConnection(function(err, connection) {
		// Use the connection
		connection.query('select count(*) as result from sys_area', function(
				err, rows, fields) {
			console.log('The solution is: ', rows[0].result);
			connection.release();
		});
	});
} else {
	var connection = mysql.createConnection({
		host : 'localhost',
		user : 'root',
		password : 'root',
		database : 'tenmalife-platform',
		typeCast : true
	});

	connection.connect();

	connection.query('select * from sys_area limit 15', function(err, rows,
			fields) {
		if (err)
			throw err;
		console.log('The solution is: ', rows);
	});

	connection.end();
}
